<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="/assets/css/bootstrap.css" rel="stylesheet">
    <link href="/assets/css/bootstrap-datetimepicker.min.css" rel="stylesheet">
    <script src="/assets/js/jquery.min.js"></script>
    <script src="/assets/js/bootstrap-datetimepicker.min.js"></script>
    <script src="/assets/js/browser.js"></script>
    <script type="text/javascript" src="/assets/js/ajaxfileupload.js"></script>
    <script src="/assets/js/bootstrap.js"></script>
    <link href="/assets/css/custom.css" rel="stylesheet">
    <script type="text/javascript" src="/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" src="/ueditor/ueditor.all.js"></script>


    <title>管理后台登录</title>
</head>
<body>
<div >
    <div class="page-header">
        <h1> <small>管理系统后台登录</small></h1>
    </div>
    <div class="page_center">
        <div class="dl_box">
            <div class="input_dl">
                <form accept-charset="UTF-8" class="form-horizontal" style="margin-top:200px;width:400px;margin-left:500px;
                "name="myform" method="post" action="/login" >
                    @csrf
                    <div class="form-group" style="">
                        <label for="username" class="col-sm-2 control-label" style="width:100px;">用户名：</label>
                        <div class="col-sm-10" style="width:300px;">
                            <input type="text" class="form-control" name="name" id="name" placeholder="请输入用户名">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="password" class="col-sm-2 control-label" style="width:100px;">密码：</label>
                        <div class="col-sm-10" style="width:300px;">
                            <input type="password" class="form-control" name="password" id="password" placeholder="请输入密码">
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-sm-10">
                            <input name="dosubmit" type="button" value="登录" class="btn btn-default" style="margin-left:27px;" onclick="login()">
                        </div>
                    </div>
                </form>
            </div>
            <script type="text/javascript">
                function login(){
                    var name=$("#name").val();
                    var password=$("#password").val();
                    $.post('/login',
                        {'name':name,'password':password,'_token':'{{csrf_token()}}'},
                        function (data){
                            if(data.success){
                                alert(data.msg);
                                location.href='/adm';
                            }else{
                                alert(data.msg);
                            }
                        },'json'
                    );
                }
            </script>

</body></html>
